package com.company.adapterMode;

/**
 * @description: 创建一个可以播放目前三种格式的播放器
 * @author: zgw
 * @create: 2020-12-07 16:24
 **/
public class AudioPlayer implements MediaPlayer{

    MediaAdapter mediaAdapter;

    @Override
    public void play(String audioType, String fileName) {
        if ("mp3".equals(audioType)){
            //自带播放器
            System.out.println("Playing Mp3 file.name:"+fileName);
        }else if ("mp4".equals(audioType)||"vlc".equals(audioType)){
            mediaAdapter = new MediaAdapter(audioType);
            mediaAdapter.play(audioType,fileName);
        }else {
            System.out.println("Playing not support");
        }
    }
}
